import React, { useState, useEffect } from "react";
import { Layout, message } from "antd";
import { useNavigate } from "react-router-dom";
import Header from "./components/Header.jsx";
import Aside from "./components/Aside";
import Bread from "./components/Bread";
// rfc快速创建

import { Outlet } from "react-router-dom";
const {  Content } = Layout;

export default function App(props) {
  const navigate = useNavigate();
  //路由守卫
  const [token, setToken] = useState(localStorage.getItem("cms-token"));
  useEffect(() => {
    if (!token) {
      message.warning("你暂未登陆");
      setTimeout(() => {
        navigate("/login");
      }, 1000);
    }
  }, []);

  return (
    <Layout id="app">
      <Header />
      <div className="container">
       
          <Aside />
    
     
          <div className="container_box">
          <Bread />
          <div className="container_content">
          <Outlet />
          </div>
              
          </div>
       
    
      </div>
      <footer>Respect | Copyright © 2022 Author 你单排吧</footer>
    </Layout>
  );
}
